// 文章列表相关操作
import request from 'utils/request'
/**
 * 获取文章列表数据
 */
export const getArticleInfo = (params) => {
  return request({
    url: 'mp/articles',
    method: 'GET',
    params
  })
}
/**
 * 删除文章
 */
export const deleteArticleList = (id) => {
  return request({
    url: `mp/articles/${id}`,
    method: 'DELETE'
  })
}
/**
 * 发布文章
 */
export const publishArticle = (data, draft = false) => {
  return request({
    url: `mp/articles?draft=${draft}`,
    method: 'POST',
    data
  })
}
/**
 * 获取文章详情信息
 */
export const getArticleDetails = (id) => {
  return request({
    url: `mp/articles/${id}`,
    method: 'GET'
  })
}
/**
 * 修改文章
 */
export const updateArticle = (data, draft) => {
  return request({
    url: `/mp/articles/${data.id}?draft=${draft}`,
    method: 'PUT',
    data,
  })
}